#define _CRT_SECURE_NO_WARNINGS 1
#include<bits/stdc++.h>
using namespace std;
#define ll long long
#define endl '\n'
const int N = 1010;
char a[N][N];

int main() {
	ios::sync_with_stdio(0), cin.tie(0), cout.tie(0);
	int n, m, k; cin >> n >> m >> k;
	for (int i = 0; i < n; i++) {
		for (int j = 0; j < m; j++) {
			cin >> a[i][j];
		}
	}
	for (int i = 0; i < n; i++) {
		for (int v = 0; v < k; v++) {
			for (int j = 0; j < m; j++) {
				for (int l = 0; l < k; l++) {
					cout << a[i][j];
				}
			}
			cout << endl;
		}
	}
	return 0;
}